<?php

/**
 * Service form base class.
 *
 * @method Service getObject() Returns the current form's model object
 *
 * @package    dashboard
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseServiceForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'serv_id'               => new sfWidgetFormInputHidden(),
      'serv_type'             => new sfWidgetFormInputText(),
      'serv_container'        => new sfWidgetFormInputText(),
      'serv_option'           => new sfWidgetFormInputText(),
      'serv_quantity'         => new sfWidgetFormInputText(),
      'serv_size'             => new sfWidgetFormInputText(),
      'serv_freq'             => new sfWidgetFormInputText(),
      'serv_group'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Service'), 'add_empty' => false)),
      'serv_dateadded'        => new sfWidgetFormDateTime(),
      'serv_rent'             => new sfWidgetFormInputText(),
      'serv_rent_period'      => new sfWidgetFormChoice(array('choices' => array('month' => 'month', 'day' => 'day'))),
      'serv_rent_days'        => new sfWidgetFormInputText(),
      'serv_monthly'          => new sfWidgetFormInputText(),
      'serv_perton'           => new sfWidgetFormInputText(),
      'serv_tonnage'          => new sfWidgetFormInputText(),
      'serv_flatrate_tonnage' => new sfWidgetFormInputText(),
      'serv_haul'             => new sfWidgetFormInputText(),
      'serv_adminfee'         => new sfWidgetFormInputText(),
      'serv_franchise'        => new sfWidgetFormInputText(),
      'serv_fuel'             => new sfWidgetFormInputText(),
      'serv_fuel_percent'     => new sfWidgetFormChoice(array('choices' => array('yes' => 'yes', 'no' => 'no'))),
      'serv_ignore_fuel'      => new sfWidgetFormChoice(array('choices' => array('no' => 'no', 'yes' => 'yes'))),
      'serv_latefee'          => new sfWidgetFormInputText(),
      'serv_recur'            => new sfWidgetFormChoice(array('choices' => array('ondemand' => 'ondemand', 'perminate' => 'perminate', 'item' => 'item'))),
      'serv_pricetype'        => new sfWidgetFormChoice(array('choices' => array('benchmark' => 'benchmark', 'newprice' => 'newprice', 'na' => 'na'))),
      'serv_custom_name'      => new sfWidgetFormInputText(),
      'serv_deleted'          => new sfWidgetFormChoice(array('choices' => array('no' => 'no', 'yes' => 'yes'))),
      'serv_all_flatrate'     => new sfWidgetFormChoice(array('choices' => array('yes' => 'yes', 'no' => 'no'))),
      'serv_item_unit'        => new sfWidgetFormInputText(),
      'serv_item_price'       => new sfWidgetFormInputText(),
      'serv_item_total'       => new sfWidgetFormInputText(),
      'account_id'            => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'serv_id'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('serv_id')), 'empty_value' => $this->getObject()->get('serv_id'), 'required' => false)),
      'serv_type'             => new sfValidatorString(array('max_length' => 255)),
      'serv_container'        => new sfValidatorString(array('max_length' => 255)),
      'serv_option'           => new sfValidatorString(array('max_length' => 255)),
      'serv_quantity'         => new sfValidatorInteger(),
      'serv_size'             => new sfValidatorString(array('max_length' => 255)),
      'serv_freq'             => new sfValidatorString(array('max_length' => 255)),
      'serv_group'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Service'))),
      'serv_dateadded'        => new sfValidatorDateTime(),
      'serv_rent'             => new sfValidatorNumber(),
      'serv_rent_period'      => new sfValidatorChoice(array('choices' => array(0 => 'month', 1 => 'day'), 'required' => false)),
      'serv_rent_days'        => new sfValidatorInteger(),
      'serv_monthly'          => new sfValidatorNumber(),
      'serv_perton'           => new sfValidatorNumber(array('required' => false)),
      'serv_tonnage'          => new sfValidatorNumber(array('required' => false)),
      'serv_flatrate_tonnage' => new sfValidatorNumber(),
      'serv_haul'             => new sfValidatorNumber(),
      'serv_adminfee'         => new sfValidatorNumber(),
      'serv_franchise'        => new sfValidatorNumber(),
      'serv_fuel'             => new sfValidatorNumber(),
      'serv_fuel_percent'     => new sfValidatorChoice(array('choices' => array(0 => 'yes', 1 => 'no'), 'required' => false)),
      'serv_ignore_fuel'      => new sfValidatorChoice(array('choices' => array(0 => 'no', 1 => 'yes'), 'required' => false)),
      'serv_latefee'          => new sfValidatorNumber(),
      'serv_recur'            => new sfValidatorChoice(array('choices' => array(0 => 'ondemand', 1 => 'perminate', 2 => 'item'), 'required' => false)),
      'serv_pricetype'        => new sfValidatorChoice(array('choices' => array(0 => 'benchmark', 1 => 'newprice', 2 => 'na'), 'required' => false)),
      'serv_custom_name'      => new sfValidatorString(array('max_length' => 150)),
      'serv_deleted'          => new sfValidatorChoice(array('choices' => array(0 => 'no', 1 => 'yes'), 'required' => false)),
      'serv_all_flatrate'     => new sfValidatorChoice(array('choices' => array(0 => 'yes', 1 => 'no'), 'required' => false)),
      'serv_item_unit'        => new sfValidatorString(array('max_length' => 30)),
      'serv_item_price'       => new sfValidatorNumber(),
      'serv_item_total'       => new sfValidatorNumber(),
      'account_id'            => new sfValidatorInteger(),
    ));

    $this->widgetSchema->setNameFormat('service[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Service';
  }

}
